#define DEBUG
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn=2000, maxm=2000, maxl=200, mods=1000000007;

int min(int a, int b) {
  return a < b ? a : b;
}

int max(int a, int b) {
  return a > b ? a : b;
}

class SegmentTree {
public:
  long long a[4*maxl+1], mark[4*maxl+1];

  void markDown(int o, int l, int r) {
    if (mark[o]>=0) {
      a[o] = (mark[o]*(r-l+1))%mods;
      if (l!=r) {
	mark[o*2]=mark[o*2+1]=mark[o];
      }
      mark[o]=-1;
    }
  }

  void set(int o, int l, int r, int tl, int tr, long long tv) {
    if (tl>tr) {
      return;
    }
    markDown(o, l, r);
    if (l==tl && r==tr) {
      mark[o] = tv;
      markDown(o, l, r);
    } else {
      int mid=(l+r)/2;
      if (tl<=mid && tr>=l) {
	set(o*2, l, mid, max(tl, l), min(tr, mid), tv);
	a[o] = (a[o]+a[o*2])%mods;
      }
      if (tl<=r && tr>mid) {
	a[o] = (a[o]+mods-a[o*2+1])%mods;
	set(o*2+1, mid+1, r, max(tl, mid+1), min(tr, r), tv);
      }
      markDown(o*2, l, mid), markDown(o*2+1, mid+1, r);
      a[o] = a[o*2]+a[o*2+1];
    }
  }

  long long get(int o, int l, int r, int tl, int tr) {
    if (tl>tr) {
      return 0;
    }
    markDown(o, l, r);
    if (l==tl && r==tr) {
      return a[o];
    } else {
      int mid=(l+r)/2;
      long long ret=0;
      if (tl<=mid && tr>=l) {
	ret = (ret+get(o*2, l, mid, max(tl, l), min(tr, mid)))%mods;
      }
      if (tl<=r && tr>mid) {
	ret = (ret+get(o*2+1, mid+1, r, max(tl, mid+1), min(tr, r)))%mods;
      }
      return ret;
    }
  }
};

bool mystrcmp(char *a, char *b) {
	return strcmp(a, b)<0;
}

int main() {
  freopen("prefix.in", "r", stdin);
  freopen("prefix.out", "w", stdout);

  static char *s[maxn+1], str[maxn+1][maxl+1];
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    s[i] = str[i];
  }
  for (int i=1; i<=n; i++) {
    scanf("%s", s[i]);
  }

  sort(s+1, s+n+1, mystrcmp);

  static int pos[maxn+1], len[maxn+1];
  for (int i=2; i<=n; i++) {
    for (pos[i]=0; s[i][pos[i]]!='\0' && s[i][pos[i]]==s[i-1][pos[i]]; pos[i]++);
  }

  static SegmentTree sgt[maxm+1];
  len[1] = strlen(s[1]);
  sgt[1].set(1, 0, maxl, 0, len[1]-1, 1);

  for (int i=2; i<=n; i++) {
    len[i] = strlen(s[i]);
    for (int j=m; j>0; j--) {
      sgt[j].set(1, 0, maxl, pos[i], len[i]-1, sgt[j-1].get(1, 0, maxl, pos[i], len[i-1]-1));
    }
  }

  printf("%lld", sgt[m].get(1, 0, maxl, 0, len[n]-1));

  fclose(stdin);
  fclose(stdout);
  return 0;
}
